s
import 'package:flutter/material.dart';

void main() =>runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context){
    return MaterialApp(
      home:HYHomePage()
    );
  }
}

class HYHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context){
    return Scaffold(
      appBar: AppBar(
        title: Text("商品列表"),
      ),
      body: HYHomeContent(),
    );
  }
}
class HYHomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context){
    return ListView(
      children: [
        HYHomeProductItem('华为电脑','huawei mac pro','https://res.vmallres.com/pimages//uomcdn/CN/pms/202310/sbom/2801010155102/428_428_b_webFB21D83652E3ED47371C9E8917A51386.png'),
        HYHomeProductItem('华为电脑','huawei mac pro','https://res.vmallres.com/pimages//uomcdn/CN/pms/202310/sbom/2801010155102/428_428_b_webFB21D83652E3ED47371C9E8917A51386.png'),
        HYHomeProductItem('华为电脑','huawei mac pro','https://res.vmallres.com/pimages//uomcdn/CN/pms/202310/sbom/2801010155102/428_428_b_webFB21D83652E3ED47371C9E8917A51386.png'),
        HYHomeProductItem('华为电脑','huawei mac pro','https://res.vmallres.com/pimages//uomcdn/CN/pms/202310/sbom/2801010155102/428_428_b_webFB21D83652E3ED47371C9E8917A51386.png'),
        HYHomeProductItem('华为电脑','huawei mac pro','https://res.vmallres.com/pimages//uomcdn/CN/pms/202310/sbom/2801010155102/428_428_b_webFB21D83652E3ED47371C9E8917A51386.png')
      ],
    );
  }
}

class HYHomeProductItem extends StatelessWidget {
  final String title;
  final String desc;
  final String imageURL;

  final style1 = TextStyle(fontSize: 25,color: Colors.orange);
  final style2 = TextStyle(fontSize: 20,color: Colors.green);

  HYHomeProductItem(this.title,this.desc,this.imageURL);

  @override
  Widget build(BuildContext context){
    return Container(
      padding: EdgeInsets.all(20),
      decoration: BoxDecoration(
        border:Border.all(
          width: 5,//设置边框宽度
          color: Colors.purple //设置边框颜色
        )
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Text(title,style: style1),
          SizedBox(height: 8),
          Text(desc,style: style2),
          SizedBox(height: 8),
          Image.network(imageURL)
        ],
      ),
    );
  }

}
